#include <iostream>  
#include <chrono>  
  
// 普通函数  
int square(int x) {  
    return x * x;  
}  
  
// 内联函数  
inline int inline_square(int x) {  
    return x * x;  
}  
  
int main() {  
    int N;  
    std::cout << "请输入函数执行次数N: ";  
    std::cin >> N;  
  
    // 计算普通函数的执行时间  
    auto start = std::chrono::high_resolution_clock::now();  
    for (int i = 0; i < N; i++) {  
        square(i);  
    }  
    auto end = std::chrono::high_resolution_clock::now();  
    auto duration = std::chrono::duration_cast<std::chrono::microseconds>(end - start);  
    std::cout << "普通函数执行" << N << "次时间为：" << duration.count() << "微秒" << std::endl;  
  
    // 计算内联函数的执行时间  
    start = std::chrono::high_resolution_clock::now();  
    for (int i = 0; i < N; i++) {  
        inline_square(i);  
    }  
    end = std::chrono::high_resolution_clock::now();  
    duration = std::chrono::duration_cast<std::chrono::microseconds>(end - start);  
    std::cout << "内联函数执行" << N << "次时间为：" << duration.count() << "微秒" << std::endl;  
  
    return 0;  
}